<!DOCTYPE HTML>

<html lang="utf-8">
<head>
<meta charset="utf-8">
<title>驾车宝典-注册</title>
<link href="${ctx}/styles/group.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/user.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/loginNReg.css" rel="stylesheet" type="text/css">
<#include '/baseHead.ftl'>
<!--主要部分开始-->
<section id="main"><div class="bgA_01">
	
	<div class="loginNRegPanel_01">
		<div class="formField">
			<nav class="menu">
				<ul>
					<li><a class="on" href="#" title="点击注册">创建踏客帐号</a></li>
					<li><a href="${ctx}/member/login" title="点击登录">我已有踏客帐号</a></li>
				</ul>
			</nav>
			<div style="padding:10px 0 0 30px;size:20px">
			注册方式:  <input checked type="radio"  name="aa"  >邮箱 <input type="radio"  name="aa">手机
			</div>
			<div class="list" id="cccc">
				<ul>
					<li class="id"><input type="text" class="txt" id="loginName" value=""></li>
					<li class="nn"><input type="text" class="txt" id="nickName" value=""></li>
					<li class="pw"><input type="password" class="txt" value="" id="password"  onkeydown="checksub(event.keyCode);"></li>
					<li class="text" style="display:none">
						<span class="pwStrength pwStrength1">弱</span><span class="pwStrength pwStrength2">中等</span><span class="pwStrength pwStrength3">强</span>
					</li>
					<li  id='verifyCodeLi' class="code" jqinfoshow="true">验证码：<input type="text" class="txt" id="verifyCode"> <input type='button' value='获取验证码' onclick='getVerifyCode()'></li>
				</ul>
			</div>
			<div class="info" id="infodiv" style="display:none" >
				<button class="btn close" title="关闭" onclick='closea();'></button>
				<span id="ccc">aa</span>	  
			</div>
			<div class="btns">
				<button class="btn btn1" title="点击注册" onclick='reg();'>注册</button>
			</div>　　
		</div>
		<div class="btnField" id="text">
			<ul>
			<!--
				<li><a href="#" class="btn btn1" title="用微博帐号登录">用微博帐号登录</a></li>
				<li><a href="#" class="btn btn2" title="用QQ帐号登录">用QQ帐号登录</a></li>
				-->
				<!--
				<li><a href="#" class="btn btn3" title="用豆瓣帐号登录">用豆瓣帐号登录</a></li>
				<li><a href="#" class="btn btn4" title="用人人帐号登录">用人人帐号登录</a></li>
				<li><a href="#" class="btn btn5" title="用腾讯微博帐号登录">用腾讯微博帐号登录</a></li>
				<li><a href="#" class="btn btn6" title="用MSN帐号登录">用MSN帐号登录</a></li>
				-->
			</ul>
		</div>
	</div>
	<#include '/commonFriendLink.ftl'>
</div></section>
<!--主要部分结束-->
<!--主要部分结束-->
<#include '/baseFoot.ftl'>
<script>
function checksub(e) {
		if (e == 13) {
			reg();
		}
	}
	function closea(){
		$('#infodiv').toggle();
	}
	function getVerifyCode(){
		if ( $('#loginName').val()  == "" ){
			$('#infodiv').css("display","block");
			$('#ccc').html("请输入手机或者邮箱作为登录名");  
			return ;
		}
		if ( $('#nickName').val()  == "" ){
			$('#infodiv').css("display","block");
			$('#ccc').html("请输入昵称");  
			return ;
		}
		if ( $('#nickName').val() .length  <4 ){
			$('#infodiv').css("display","block");
			$('#ccc').html("昵称过短");  
			return ;
		}
		if ( $('#nickName').val() .length > 16 ){
			$('#infodiv').css("display","block");
			$('#ccc').html("昵称过长");  
			return ;
		}
		if ( $('#nickName').val()  == "" ){
			$('#infodiv').css("display","block");
			$('#ccc').html("请输入昵称");  
			return ;
		}
		if ( $('#password').val()  == "" ){
			$('#infodiv').css("display","block");
			$('#ccc').html("对不起,请输入密码");  
			return ;
		}
		if ( $('#password').val() .length< 6 ){
			$('#infodiv').css("display","block");
			$('#ccc').html("密码至少为6位");  
			return ;
		}
		if ( $('#password').val() .length > 12){
			$('#infodiv').css("display","block");
			$('#ccc').html("密码最多为12位");  
			return ;
		}
		$.ajax({
		 			type: "get",
					url: "${ctx}/member/getverifycode",
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						if ( data.state == 1){
							$('#infodiv').css("display","block");
							$('#ccc').html("验证码已发送到您输入的邮箱/手机,请注意查收");  
						}else{
							  	$('#infodiv').css("display","block");
								$('#ccc').html(data.desc);  
								return ;
						}
					},
					data:{
						nickName:$('#nickName').val() ,
						loginName:$('#loginName').val() ,
						password:$('#password').val() 
					},
					dataType:'json'
				}
	 		)
	}
	function reg(){
		if ( $('#loginName').val()  == "" ){
			$('#infodiv').css("display","block");
			$('#ccc').html("请输入手机或者邮箱作为登录名");  
			return ;
		}
		if ( $('#nickName').val()  == "" ){
			$('#infodiv').css("display","block");
			$('#ccc').html("请输入昵称");  
			return ;
		}
		if ( $('#nickName').val() .length  <4 ){
			$('#infodiv').css("display","block");
			$('#ccc').html("昵称过短");  
			return ;
		}
		if ( $('#nickName').val() .length > 16 ){
			$('#infodiv').css("display","block");
			$('#ccc').html("昵称过长");  
			return ;
		}
		if ( $('#nickName').val()  == "" ){
			$('#infodiv').css("display","block");
			$('#ccc').html("请输入昵称");  
			return ;
		}
		if ( $('#password').val()  == "" ){
			$('#infodiv').css("display","block");
			$('#ccc').html("对不起,请输入密码");  
			return ;
		}
		if ( $('#password').val() .length< 6 ){
			$('#infodiv').css("display","block");
			$('#ccc').html("密码至少为6位");  
			return ;
		}
		if ( $('#password').val() .length > 12){
			$('#infodiv').css("display","block");
			$('#ccc').html("密码最多为12位");  
			return ;
		}
		if ( $('#verifyCode').val()  == "" ){
			$('#infodiv').css("display","block");
			$('#ccc').html("验证码必填，请点击右侧按钮获取验证码");  
			return ;
		}
		$.ajax({
		 			type: "get",
					url: "${ctx}/member/regaction",
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						if ( data.state == 1){
							alert("注册成功");
							window.location.href = "${ctx}/member/reg/success";
						}else{
							  	$('#infodiv').css("display","block");
								$('#ccc').html(data.desc);  
								return ;
						}
					},
					data:{
						nickName:$('#nickName').val() ,
						loginName:$('#loginName').val() ,
						password:$('#password').val() ,
						verifyCode:$('#verifyCode').val()
					},
					dataType:'json'
				}
	 		)
	}
</script>
<!--弹出框开始-->
<section id="jumpBox">
	<div class="mask"></div>
	<!--快捷登录框开始-->
	<div class="loginPanel_01">
		<div class="titleField">
			<p class="more"><button class="btn close" title="关闭">关闭</button></p>
			<h1>欢迎登陆</h1>
		</div>
		<div class="formField">
			<ul>
				<li class="id"><input type="text" class="txt" value=""></li>
				<li class="links"><a href="#" class="link link1" title="忘记密码了？">忘记密码了？</a></li>
				<li class="pw"><input type="password" class="txt" value=""></li>
				<li class="links"><a href="#" class="link link2" title="点击注册">免费注册</a> <input type="checkbox" class="check" id="rememberMe"><label for="rememberMe">十天内免登陆</label></li>
			</ul>
		</div>
		<div class="btnField">
			<button class="btn btn1" title="点击登录">登 &nbsp;录</button>
		</div>
	</div>
	<!--快捷登录框结束-->
</section>
<!--弹出框结束-->
</body>  

</html>

